package com.blink.zookeeper.operate.auth;

import com.blink.zookeeper.ZooKeeperCreator;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.ZooDefs.Ids;
import org.apache.zookeeper.ZooKeeper;

//使用含权限信息的ZooKeeper会话创建数据节点
public class AuthSample {
    final static String PATH = "/zk-book-auth_test";

    public static void main(String[] args) throws Exception {
        ZooKeeper zookeeper = ZooKeeperCreator.getZk("AuthSample");
        zookeeper.addAuthInfo("digest", "foo:true".getBytes());
        zookeeper.create(PATH, "init".getBytes(), Ids.CREATOR_ALL_ACL, CreateMode.EPHEMERAL);
        Thread.sleep(Integer.MAX_VALUE);
    }
}